package com.qf.config;

import dev.miku.r2dbc.mysql.MySqlConnectionConfiguration;
import dev.miku.r2dbc.mysql.MySqlConnectionFactory;
import io.r2dbc.spi.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.ZoneId;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/22 20:34
 */
//@Configuration
public class MyConfig {
//    配置类模式配置r2dbc
//    @Bean
    ConnectionFactory connectionFactory() {
        return MySqlConnectionFactory.from(MySqlConnectionConfiguration.builder()
                .host("127.0.0.1")
                .port(3306)
                .username("root")
                .password("qishimeiyoumima")
                .serverZoneId(ZoneId.of(ZoneId.SHORT_IDS.get("CTT")))
                .database("webfluxtest")//设置库
                // 额外的其它非必选参数省略
                .build());
    }
}
